<%--
  Created by IntelliJ IDEA.
  User: cy123
  Date: 2021/10/16
  Time: 9:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="resource/css/index.css">
    <script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
</head>
<body>
    <form:form action="list" method="post" modelAttribute="tj">
        报销日期:<form:input path="mindate" type="date"></form:input>至
                <form:input path="maxdate" type="date"></form:input>
        报销单号:<form:input path="id"></form:input><br>
        医疗总费用:<form:input path="mintotal"></form:input>至
                <form:input path="maxtotal"></form:input>
        所属部门:<form:select path="did">
                    <form:option value="" label="请选择"></form:option>
                    <form:options items="${dept}" itemLabel="deptname" itemValue="deptid"></form:options>
                </form:select>
        员工姓名:<form:select path="eid">
                    <form:option value="" label="请选择"></form:option>
                    <form:options items="${pg.list}" itemLabel="ename" itemValue="eid"></form:options>
                </form:select>
        <input type="submit" value="查询">
        <a href="add">新增</a>
        <table>
            <thead>
                <tr>
                    <td>报销日期</td>
                    <td>报销单号</td>
                    <td>员工编号</td>
                    <td>员工姓名</td>
                    <td>性别</td>
                    <td>所属部门</td>
                    <td>医疗总费用</td>
                    <td>附件</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <C:forEach items="${pg.list}" var="e">
                    <tr>
                        <td><fmt:formatDate value="${e.date}"></fmt:formatDate></td>
                        <td>${e.id}</td>
                        <td>${e.eid}</td>
                        <td>${e.ename}</td>
                        <td>${e.sex.name}</td>
                        <td>${e.dname}</td>
                        <td>${e.total}</td>
                        <td>${e.attachment}</td>
                        <td><input type="button" value="修改" onclick="up(${e.id})"><input type="button" value="删除" onclick="del(${e.id})"></td>
                    </tr>
                </C:forEach>
                <tr>
                    <td colspan="10" align="center">
                        <button name="pageNum" value="${pg.prePage==0?1:pg.prePage}">上一页</button>
                        <c:forEach items="${pg.navigatepageNums}" var="i">
                            <button name="pageNum" value="${i}">${i}</button>
                        </c:forEach>
                        <button name="pageNum" value="${pg.nextPage==0?pg.pages:pg.nextPage}">下一页</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </form:form>
    <script>
        function del(id){
            if(confirm("确定要删除么?")){
                location = "del?id="+id;
            }
        }
        function up(id){
            location="up?id="+id;
        }
    </script>
</body>
</html>
